#ifndef __EVENT_H__
#define __EVENT_H__

#include <string>
#include <functional>
#include "plat/nonecopyable.h"

class Event : public NoneCopyable
{
public:
    explicit Event();
    virtual ~Event();

public:
    void Set(uint32_t flags);
    uint32_t Get();
    void Clear(uint32_t flags);

    uint32_t WaitAny(uint32_t flags, bool clear = true, int timeout = -1);
    uint32_t WaitAll(uint32_t flags, bool clear = true, int timeout = -1);

private:
    uint32_t WaitImpl(uint32_t flags, uint32_t option, int timeout = -1);
    
private:
    void CreateEvent();
    void DeleteEvent();

private:
    void *m_eventHandle = nullptr;
};

#endif // __EVENT_H__
